<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
       
        h1 {
            -webkit-user-select: none;
        }

        ul {
            display: none;
            position: absolute;
        }
    </style>
</head>
<body>

    <h1>2222</h1>

    <ul>
        <li>
            <a href="http://baidu.com">百度</a>
        </li>
        <li>
            <a href="http://jd.com">京东</a>
        </li>
    </ul>

    <input type="text">

    <script>

        // 复制  copy

        // 粘贴  paste

        // 右键事件  contextmenu

        var oInp = document.querySelector('input') ;

        // 粘贴事件  --- 阻止默认事件
        oInp.onpaste = function() {
            return false ;
        }

        oInp.oncopy = function() {
            alert('不允许复制')
            return false ;
        }

        // 模拟右键菜单效果
        var oUl = document.querySelector('ul') ;
        document.oncontextmenu = function(e) {
            
            oUl.style.display = 'block' ; 
            oUl.style.left = e.x + 'px' ;
            oUl.style.top = e.y + 'px' ;
            
            return false ;
        }

    </script>
    
</body>
</html>